package net.takela.push.service.sp;



import net.takela.common.spring.http.HttpResponse;
import net.takela.push.model.PushApp;
import net.takela.push.model.PushMsgTpl;

import java.util.List;
import java.util.Map;

/**
 * Created by baboy on 25/07/2017.
 */
public abstract class ServiceProvider {
    private PushApp pushApp;
    private List<PushMsgTpl> msgTpls;

    public PushApp getPushApp() {
        return pushApp;
    }

    public void setPushApp(PushApp pushApp) {
        this.pushApp = pushApp;
    }

    public List<PushMsgTpl> getMsgTpls() {
        return msgTpls;
    }
    public void setMsgTpls(List<PushMsgTpl> msgTpls){
        this.msgTpls = msgTpls;
    }
    public PushMsgTpl getMsgTpl(String msgCode){
        if (msgTpls == null){
            return null;
        }
        for(PushMsgTpl pushMsgTpl : msgTpls){
            if (pushMsgTpl.getCode().equals(msgCode)){
                return pushMsgTpl;
            }
        }
        return null;
    }
    public abstract  HttpResponse<?> send(String msgCode, Map<String, String> data, String ip);
}
